import App from './App'

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false
App.mpType = 'app'
Vue.directive('throttle', {
	bind: (el, binding) => {
		let throttleTime = binding.value; // 节流时间
		if (!throttleTime) { // 用户若不设置节流时间，则默认2s
			throttleTime = 1000;
		}
		let cbFun;
		el.addEventListener('click', event => {
			if (!cbFun) { // 第一次执行
				cbFun = setTimeout(() => {
					cbFun = null;
				}, throttleTime);
			} else {
				event && event.stopImmediatePropagation();
			}
		}, true);
	},
});
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  return {
    app
  }
}
// #endif